﻿using System.ComponentModel;
using OpenCube.Model.Primitives.Converters;
using OpenCube.Nbt.Mapping.Attributes;

namespace OpenCube.Model
{
	public sealed class GameRules
	{
		/// <summary>
		/// Gets or sets if output from command blocks is outputted to the chat window
		/// </summary>
		[NbtName("commandBlockOutput")]
		[DefaultValue(true)]
		[NbtConverter(typeof(BooleanStringConverter))]
		public bool CommandBlockOutput { get; set; }

		/// <summary>
		/// Gets or sets if the daylight cycle is enabled
		/// </summary>
		[NbtName("doDaylightCycle")]
		[DefaultValue(true)]
		[NbtConverter(typeof(BooleanStringConverter))]
		public bool DoDaylightCycle { get; set; }

		/// <summary>
		/// Gets or sets if fire spreads
		/// </summary>
		[NbtName("doFireTick")]
		[DefaultValue(true)]
		[NbtConverter(typeof(BooleanStringConverter))]
		public bool DoFireTick { get; set; }

		/// <summary>
		/// Gets or sets if mobs shoot drop loot when killed.
		/// </summary>
		[NbtName("doMobLoot")]
		[DefaultValue(true)]
		[NbtConverter(typeof(BooleanStringConverter))]
		public bool DoMobLoot { get; set; }

		/// <summary>
		/// Gets or sets if mobs should spawn naturally
		/// </summary>
		[NbtName("doMobSpawning")]
		[DefaultValue(true)]
		[NbtConverter(typeof(BooleanStringConverter))]
		public bool DoMobSpawning { get; set; }

		/// <summary>
		/// Gets or sets if braking blocks drops items.
		/// </summary>
		[NbtName("doTileDrops")]
		[DefaultValue(true)]
		[NbtConverter(typeof(BooleanStringConverter))]
		public bool DoTileDrops { get; set; }

		/// <summary>
		/// Gets or sets if the players keep there inventory after dying
		/// </summary>
		[NbtName("keepInventory")]
		[DefaultValue(false)]
		[NbtConverter(typeof(BooleanStringConverter))]
		public bool KeepInventory { get; set; }

		/// <summary>
		/// Gets or sets if commands from admins are logged to the server log.
		/// </summary>
		[NbtName("logAdminCommands")]
		[DefaultValue(true)]
		[NbtConverter(typeof(BooleanStringConverter))]
		public bool LogAdminCommands { get; set; }

		/// <summary>
		/// Get or sets if mobs can break blocks (creepers exploding, zombies breaking doors.)
		/// </summary>
		[NbtName("mobGriefing")]
		[DefaultValue(true)]
		[NbtConverter(typeof(BooleanStringConverter))]
		public bool MobGriefing { get; set; }

		/// <summary>
		/// Gets or sets if the players auto regenerate there health when hungerbar is high enough.
		/// </summary>
		[NbtName("naturalRegeneration")]
		[DefaultValue(true)]
		[NbtConverter(typeof(BooleanStringConverter))]
		public bool NaturalRegeneration { get; set; }

		/// <summary>
		/// Gets or sets how often the random tick occurs that let natural procresses in the world occure, like plant growth.
		/// </summary>
		[NbtName("randomTickSpeed")]
		[DefaultValue(3)]
		[NbtConverter(typeof(IntegerStringConverter))]
		public int RandomTickSpeed { get; set; }

		/// <summary>
		/// Get sor sets if the commands that commandblocks execute should be echoed to the chat window.
		/// </summary>
		[NbtName("sendCommandFeedback")]
		[DefaultValue(true)]
		[NbtConverter(typeof(BooleanStringConverter))]
		public bool SendCommandFeedback { get; set; }

		/// <summary>
		/// Gets or sets if a message about the players death should be outputed to the chat window.
		/// </summary>
		[NbtName("showDeathMessages")]
		[DefaultValue(true)]
		[NbtConverter(typeof(BooleanStringConverter))]
		public bool ShowDeathMessages { get; set; }

	}
}